<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>个人资料</title>
	<link rel="stylesheet" href="/pear/component/pear/css/pear.css" />
	<link rel="stylesheet" href="/pear/admin/css/other/person.css" />
</head>
<body class="pear-container">
	<div class="layui-row layui-col-space10">
		<div class="layui-col-md3">
			<div class="layui-card">
				<div class="layui-card-body" style="padding: 25px;">
					<div class="text-center layui-text">
						<div class="user-info-head" id="userInfoHead">
							<img src="/pear/admin/images/avatar.jpg" id="userAvatar" width="115px" height="115px" alt="">
						</div>
						<h2 style="padding-top: 20px;font-size: 20px;">
							<span th:text="${session.user?.nickname}"></span>
						</h2>
						<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China ， 中国</p>
					</div>
				</div>
				<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
					<span th:text="${userInfo?.motto}"></span>
				</div>
			</div>

			<div class="layui-card">
				<div class="layui-card-header">
					标签
				</div>
				<div class="layui-card-body">
					<ul class="list" th:each="label : ${labelList}">
						<li class="list-item">
							<a th:href="'/label/articleLabelPage?id=' + ${label.id}" target="_blank">
								<span class="title" th:text="${label.content}"></span>
								<span class="footer" th:text="${label.addTimeShow}"></span>
							</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<div class="layui-col-md9">
			<div class="layui-card">
				<div class="layui-card-header">
					我的最近十篇文章
				</div>
				<div class="layui-card-body">
					<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
						<div class="layui-tab-content">
							<div class="layui-tab-item layui-show">
								<div class="layui-row layui-col-space10" style="margin: 15px;" th:each="article : ${articleList}">
									<div class="layui-col-md1">
										<img src="/pear/admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
									</div>
									<div class="layui-col-md11" style="height: 80px;">
										<a th:href="'/article/articleShow?id=' + ${article.id}" target="_blank">
											<div class="title" th:text="${article.title}"></div>
											<div class="content" th:text="${article.abstractText}"></div>
											<div class="comment">
												<span th:text="${article.addTimeShow}"></span>
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 评论 5 点赞 12 转发 4
											</div>
										</a>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/pear/component/layui/layui.js"></script>
	<script src="/pear/component/pear/pear.js"></script>
	<script>
		layui.use(['jquery', 'element', 'layer', 'convert'], function () {
			var element = layui.element,
				layer = layui.layer,
				$ = layui.jquery,
				convert = layui.convert;

			let MODULE_PATH = "operate/";
			
			var image = new Image();
			image.src = "/pear/admin/images/avatar.jpg";
			image.onload = function() {
				$("#userAvatar").attr("src", convert.imageToBase64(image));
			}
			
			window.callback = function (data) {
				layer.close(data.index);
                $("#userAvatar").attr("src", data.newAvatar);
            }

			$("#userAvatar").click(function () {
				layer.open({
					type: 2,
					title: '更换图片',
					shade: 0.1,
					area: ["900px", "500px"],
					content: MODULE_PATH + 'profile.html',
					btn: ['确定', '取消'],
					yes: function (index, layero) {
						window['layui-layer-iframe' + index].submitForm();
					}
				});
			});
		});
	</script>
</body>
</html>
